home *** CD-ROM | disk | FTP | other *** search
/ Download Now 8 / Download Now V8.iso / Program / InternetTools / CoffeeCupHTMLeditor / CoffeeHTML82.exe / %MAINDIR% / cgi-bin / formmail / FormMail.txt < prev   
Encoding:
Text File  |  2000-05-08  |  17.8 KB  |  446 lines

  1. This is the Readme.txt to help you.  The actual CGI script is the file named:
  2. 'FormMail.pl'.
  3.  
  4. ##############################################################################
  5. # FormMail                        Version 1.6                                #
  6. # Copyright 1996-1997 Matt Wright mattw@worldwidemart.com                    #
  7. # Created 06/09/95                Last Modified 05/02/97                     #
  8. # Matt's Script Archive, Inc.:    http://www.scriptarchive.com               #
  9. ##############################################################################
  10. # If you run into any problems while trying to configure this scripts, help
  11. # is available.  The steps you should take to get the fastest results, are:
  12. #    1) Read this file thoroughly
  13. #    2) Consult the Matt's Script Archive Frequently Asked Questions if you
  14. #    are having any problems:
  15. #        http://www.worldwidemart.com/scripts/faq/
  16. #
  17. # Hopefully we will be able to help you solve your problems.  Thank you.
  18. ##############################################################################
  19.  
  20. FormMail is a universal WWW form to E-mail gateway.  There is only one
  21. required form input tag which must be specified in order for this script to
  22. work with your existing forms.  Other hidden configuration fields can also
  23. be used to enhance the operation of FormMail on your site.  Version 1.6 of
  24. FormMail contains a few minor bug fixes, optimized code and more comments.
  25. The biggest change in this version is that by default, form fields are now
  26. sorted as they appear in the form.  Error pages were also beautified a
  27. little and two new configuration fields were created.  Read the History for
  28. a more complete list of changes.
  29.  
  30. The script, FormMail.pl, needs to be placed in your server's cgi-bin and the 
  31. anonymous WWW user must have the ability to read/execute the script.  If 
  32. you do not have access to your server's cgi-bin, yet you can execute cgi 
  33. scripts, you may want to try adding a .cgi extension to the FormMail.pl, 
  34. so you could move it to FormMail.cgi.
  35.  
  36. Setting Up the FormMail Script:
  37. ===============================
  38.  
  39. The FormMail.pl script does not have to be extensively configured in order 
  40. to work.  There are only two variables in the perl file which you will 
  41. need to define along with changing the top line of your script to match 
  42. the location of you Perl interpreter.
  43.  
  44. Necessary Variables:
  45. --------------------
  46.  
  47.   $mailprog = '/usr/lib/sendmail';
  48.     This variable must define the location to your server's sendmail 
  49.     program.  If this is incorrect, form results will not be mailed to you.
  50.  
  51.   @referers = ('worldwidemart.com','206.31.72.203');
  52.     This array allows you to define the domains that you will allow 
  53.     forms to reside on and use your FormMail script.  If a user tries to 
  54.     put a form on another server, that is not worldwidemart.com, they 
  55.     will receive an error message when someone tries to fill out their form.
  56.     By placing worldwidemart.com in the @referers array, this also allows
  57.     www.worldwidemart.com, ftp.worldwidemart.com, any other http address
  58.     with worldwidemart.com in it and worldwidemart.com's IP address to access
  59.     this script as well, so no users will be turned away.
  60.  
  61. Your FormMail program is now configured.
  62.  
  63. -----------------------------------------------------------------------------
  64.  
  65. Form Configuration:
  66. ===================
  67.  
  68. The action of your form needs to point towards this script (obviously), and 
  69. the method must be POST or GET in capital letters.  Version 1.5 of FormMail 
  70. offers many new ways to code your form to tailor the resulting HTML page 
  71. and the way the script performs.  Below is a list of form fields you can 
  72. use and how to implement them.
  73.  
  74. Necessary Form Fields:
  75. ======================
  76.  
  77. There is only one form field that you must have in your form, for 
  78. FormMail to work correctly.  This is the recipient field.
  79.  
  80. Field:       recipient
  81.  
  82. Description: This form field allows you to specify to whom you wish for your
  83.              form results to be mailed.  Most likely you will want to
  84.              configure this option as a hidden form field with a value equal
  85.              to that of your e-mail address.
  86.  
  87. Syntax:
  88.              <input type=hidden name="recipient" value="email@your.host.com">
  89.  
  90. -----------------------------------------------------------------------------
  91.  
  92. Optional Form Fields:
  93. =====================
  94.  
  95. Field:       subject
  96.  
  97. Description: The subject field will allow you to specify the subject that you
  98.              wish to appear in the e-mail that is sent to you after this form
  99.              has been filled out.  If you do not have this option turned on,
  100.              then the script will default to a message subject: WWW Form
  101.              Submission
  102.  
  103. Syntax:
  104.              If you wish to choose what the subject is:
  105.               <input type=hidden name="subject" value="Your Subject">
  106.  
  107.              To allow the user to choose a subject:
  108.               <input type=text name="subject">
  109.  
  110. -----------------------------------------------------------------------------
  111.  
  112. Field:       email
  113.  
  114. Description: This form field will allow the user to specify their return
  115.              e-mail address.  If you want to be able to return e-mail to your
  116.              user, I strongly suggest that you include this form field and
  117.              allow them to fill it in.  This will be put into the From:
  118.              field of the message you receive.  If you want to require an
  119.              email address with valid syntax, add this field name to the
  120.              'required' field.
  121.  
  122. Syntax:
  123.              <input type=text name="email">
  124.  
  125. -----------------------------------------------------------------------------
  126.  
  127. Field:       realname
  128.  
  129. Description: The realname form field will allow the user to input their real
  130.              name.  This field is useful for identification purposes and will
  131.              also be put into the From: line of your message header.
  132.  
  133. Syntax: 
  134.              <input type=text name="realname">
  135.  
  136. -----------------------------------------------------------------------------
  137.  
  138. Field:       redirect
  139.  
  140. Description: If you wish to redirect the user to a different URL, rather than
  141.              having them see the default response to the fill-out form, you
  142.              can use this hidden variable to send them to a pre-made HTML
  143.              page.
  144.  
  145. Syntax:
  146.              To choose the URL they will end up at:
  147.                <input type=hidden name="redirect" 
  148.                                   value="http://your.host.com/to/file.html">
  149.  
  150.              To allow them to specify a URL they wish to travel to once the
  151.              form is filled out:
  152.                <input type=text name="redirect">
  153.  
  154. -----------------------------------------------------------------------------
  155.  
  156. Field:       required
  157.  
  158. Version:     1.3 & Up
  159.  
  160. Description: You can now require for certain fields in your form to be filled
  161.              in before the user can successfully submit the form.  Simply
  162.              place all field names that you want to be mandatory into this
  163.              field.  If the required fields are not filled in, the user will
  164.              be notified of what they need to fill in, and a link back to
  165.              the form they just submitted will be provided.
  166.  
  167.              To use a customized error page, see 'missing_fields_redirect'
  168.  
  169. Syntax:
  170.              If you want to require that they fill in the email and phone
  171.              fields in your form, so that you can reach them once you have
  172.              received the mail, use a syntax like:
  173.  
  174.                <input type=hidden name="required" value="email,phone">
  175.  
  176. -----------------------------------------------------------------------------
  177.  
  178. Field:       env_report
  179.  
  180. Version:     1.3 & Up
  181.  
  182. Description: Allows you to have Environment variables included in the
  183.              e-mail message you receive after a user has filled out your
  184.              form.  Useful if you wish to know what browser they were using,
  185.              what domain they were coming from or any other attributes
  186.              associated with environment variables.  The following is a short
  187.              list of valid environment variables that might be useful:
  188.  
  189.              REMOTE_HOST     - Sends the hostname making a request.
  190.              REMOTE_ADDR     - Sends the IP address of the remote host making
  191.                                the request.
  192.              REMOTE_USER     - If server supports authentication and script
  193.                                is protected, this is the username they have
  194.                                authenticated as. *This is not usually set.*
  195.              HTTP_USER_AGENT - The browser the client is using to send the
  196.                                request.  
  197.  
  198.              There are others, but these are a few of the most useful.  For
  199.              more information on environment variables, see:
  200.  
  201.             http://www.cgi-resources.com/Documentation/Environment_Variables/
  202.  
  203. Syntax:
  204.              If you wanted to find the remote host and browser sending the
  205.              request, you would put the following into your form:
  206.  
  207.               <input type=hidden name="env_report" value="REMOTE_HOST,
  208.                                                            HTTP_USER_AGENT">
  209.  
  210. -----------------------------------------------------------------------------
  211.  
  212. Field:       sort
  213.  
  214. Version:     1.4 & Up
  215.  
  216. Description: This field allows you to choose the order in which you wish 
  217.              for your variables to appear in the e-mail that FormMail
  218.              generates.  You can choose to have the field sorted
  219.              alphabetically or specify a set order in which you want the
  220.              fields to appear in your mail message.  By leaving this field
  221.              out, the order will simply default to the order in which the 
  222.              browsers sends the information to the script (which is usually
  223.              the exact same order as they appeared in the form.)  When
  224.              sorting by a set order of fields, you should include the phrase
  225.              "order:" as the first part of your value for the sort field, and
  226.              then follow that with the field names you want to be listed in
  227.              the e-mail message, separated by commas.  Version 1.6 allows a
  228.              little more flexibility in the listing of ordered fields, in
  229.              that you can include spaces and line breaks in the field without
  230.              it messing up the sort.  This is helpful when you have many form
  231.              fields and need to insert a line wrap.
  232.  
  233. Syntax:
  234.              To sort alphabetically:
  235.                <input type=hidden name="sort" value="alphabetic">
  236.  
  237.              To sort by a set field order:
  238.                <input type=hidden name="sort" value="order:name1,name2,
  239.                                                    name3,etc...">
  240.  
  241. -----------------------------------------------------------------------------
  242.  
  243. Field:       print_config
  244.  
  245. Version:     1.5 & Up
  246.  
  247. Description: print_config allows you to specify which of the config 
  248.              variables you would like to have printed in your e-mail message.
  249.              By default, no config fields are printed to your e-mail.  This
  250.              is because the important form fields, like email, subject, etc.
  251.              are included in the header of the message.  However some users
  252.              have asked for this option so they can have these fields printed
  253.              in the body of the message.  The config fields that you wish to
  254.              have printed should be in the value attribute of your input tag
  255.              separated by commas.
  256.  
  257. Syntax:
  258.              If you want to print the email and subject fields in the body of
  259.              your message, you would place the following form tag:
  260.  
  261.               <input type=hidden name="print_config" value="email,subject">
  262.  
  263. -----------------------------------------------------------------------------
  264.  
  265. Field:       print_blank_fields
  266.  
  267. Version:     1.6
  268.  
  269. Description: print_blank_fields allows you to request that all form fields
  270.              are printed in the return HTML, regardless of whether or not
  271.              they were filled in.  FormMail defaults to turning this off, so
  272.              that unused form fields aren't e-mailed.
  273.  
  274. Syntax:
  275.  
  276.              If you want to print all blank fields:
  277.               <input type=hidden name="print_blank_fields" value="1">
  278.  
  279. ----------------------------------------------------------------------------
  280.  
  281. Field:       title
  282.  
  283. Version:     1.3 & Up
  284.  
  285. Description: This form field allows you to specify the title and header that
  286.              will appear on the resulting page if you do not specify a
  287.              redirect URL.
  288.  
  289. Syntax:
  290.              If you wanted a title of 'Feedback Form Results':
  291.               <input type=hidden name="title" value="Feedback Form Results">
  292.  
  293. -----------------------------------------------------------------------------
  294.  
  295. Field:       return_link_url
  296.  
  297. Version:     1.3 & Up
  298.  
  299. Description: This field allows you to specify a URL that will appear, as
  300.              return_link_title, on the following report page.  This field
  301.              will not be used if you have the redirect field set, but it is
  302.              useful if you allow the user to receive the report on the
  303.              following page, but want to offer them a way to get back to
  304.              your main page.
  305.  
  306. Syntax:
  307.              <input type=hidden name="return_link_url" 
  308.                              value="http://your.host.com/main.html">
  309.  
  310. -----------------------------------------------------------------------------
  311.  
  312. Field:       return_link_title
  313.  
  314. Version:     1.3 & Up
  315.  
  316. Description: This is the title that will be used to link the user back to the
  317.              page you specify with return_link_url.  The two fields will be
  318.              shown on the resulting form page as:
  319.  
  320.              <ul>
  321.               <li><a href="return_link_url">return_link_title</a>
  322.              </ul>
  323.  
  324. Syntax:
  325.              <input type=hidden name="return_link_title"
  326.                                                   value="Back to Main Page">
  327.  
  328. -----------------------------------------------------------------------------
  329.  
  330. Field:       missing_fields_redirect
  331.  
  332. Version:     1.6
  333.  
  334. Description: This form field allows you to specify a URL that users will be
  335.              redirected to if there are fields listed in the required form
  336.              field that are not filled in.  This is so you can customize an
  337.              error page instead of displaying the default.
  338.  
  339. Syntax:
  340.              <input type=hidden name="missing_fields_redirect"
  341.                                     value="http://your.host.com/error.html">
  342.  
  343. -----------------------------------------------------------------------------
  344.  
  345. Field:       background
  346.  
  347. Version:     1.3 & Up
  348.  
  349. Description: This form field allow you to specify a background image that
  350.              will appear if you do not have the redirect field set.  This
  351.              image will appear as the background to the form results page.
  352.  
  353. Syntax:
  354.              <input type=hidden name="background"
  355.                                      value="http://your.host.com/image.gif">
  356.  
  357. -----------------------------------------------------------------------------
  358.  
  359. Field:       bgcolor
  360.  
  361. Version:     1.3 & Up
  362.  
  363. Description: This form field allow you to specify a bgcolor for the form
  364.              results page in much the way you specify a background image.
  365.              This field should not be set if the redirect field is.
  366.  
  367. Syntax:
  368.              For a background color of White:
  369.               <input type=hidden name="bgcolor" value="#FFFFFF">
  370.  
  371. -----------------------------------------------------------------------------
  372.  
  373. Field:       text_color
  374.  
  375. Version:     1.3 & Up
  376.  
  377. Description: This field works in the same way as bgcolor, except that it
  378.              will change the color of your text.
  379.  
  380. Syntax:
  381.              For a text color of Black:
  382.               <input type=hidden name="text_color" value="#000000">
  383.  
  384. -----------------------------------------------------------------------------
  385.  
  386. Field:       link_color
  387.  
  388. Version:     1.3 & Up
  389.  
  390. Description: Changes the color of links on the resulting page.  Works in the
  391.              same way as text_color.  Should not be defined if redirect is.
  392.  
  393. Syntax:
  394.              For a link color of Red:
  395.               <input type=hidden name="link_color" value="#FF0000">
  396.  
  397. -----------------------------------------------------------------------------
  398.  
  399. Field:       vlink_color
  400.  
  401. Version:     1.3 & Up
  402.  
  403. Description: Changes the color of visited links on the resulting page. Works
  404.              exactly the same as link_color.  Should not be set if redirect
  405.              is.
  406.  
  407. Syntax:
  408.              For a visited link color of Blue:
  409.               <input type=hidden name="vlink_color" value="#0000FF">
  410.  
  411. -----------------------------------------------------------------------------
  412.  
  413. Field:       alink_color
  414.  
  415. Version:     1.4 & Up
  416.  
  417. Description: Changes the color of active links on the resulting page. Works
  418.              exactly the same as link_color.  Should not be set if redirect
  419.              is.
  420.  
  421. Syntax:
  422.              For a visited link color of Blue:
  423.               <input type=hidden name="alink_color" value="#0000FF">
  424.  
  425. -----------------------------------------------------------------------------
  426.  
  427. Any other form fields that appear in your script will be mailed back to 
  428. you and displayed on the resulting page if you do not have the redirect 
  429. field set.  There is no limit as to how many other form fields you can 
  430. use with this form, except the limits imposed by browsers and your server.
  431.  
  432. -----------------------------------------------------------------------------
  433.  
  434. Some of the possible uses of this script are:
  435.  
  436. 1) You want to have a form that will be mailed to you, but aren't sure how to 
  437.    write the CGI script for it.
  438. 2) You are the webmaster of your site and want to allow users to use forms, 
  439.    but not to have their own cgi-bin directories, which can cause 
  440.    security risks to your system.  You can set this script up and then 
  441.    allow all users to run off of it.
  442. 3) Want to have one script to parse all of your html forms and mail them 
  443.    to you.
  444.  
  445. -----------------------------------------------------------------------------
  446. Matt Wright - mattw@worldwidemart.com - http://www.worldwidemart.com/scripts/